package com.yangchoi.lib_base.network.interceptor

import com.orhanobut.logger.Logger
import com.yangchoi.lib_base.base.BaseApplication
import okhttp3.Interceptor
import okhttp3.Request
import okhttp3.Response

// 请求头拦截器,用于添加请求头,要放在log拦截器前面add
class HeaderInterceptor : Interceptor {

    override fun intercept(chain: Interceptor.Chain): Response {
        // token
//        val userInfo =
//            BaseApplication.kv!!.decodeParcelable("USER_INFO_KEY", UserInfoEntity::class.java)

        val original: Request = chain.request()
        val requestBuilder: Request.Builder = original.newBuilder()
//            .header("Authorization", "Bearer ${userInfo?.token}")
        val request: Request = requestBuilder.build()

        return chain.proceed(request)
    }

}